// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
// 使用全局样
import '@/assets/css/global.css'
// 导入element-ui
import 'element-ui/lib/theme-chalk/index.css'
import ElementUI from 'element-ui'
// 引入路由 [解决重复点击路径报错问题]
import VueRouter from 'vue-router'
// 引入 store
import store from './store'
// 设置axios为全部可用
import axios from 'axios'
// 使用全局脚本语言
// import axiosRequest from '@/assets/js/request.js'
// Vue.prototype.$axiosRequest = axiosRequest
// import axiosApi from '@/utils/api.js'
// Vue.prototype.$axiosApi = axiosApi

Vue.prototype.$axios = axios
Vue.use(VueRouter)

// 解决重复点击相同路由报错 [解决重复点击路径报错问题]
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}

// 定义一个统一的请求头
axios.defaults.baseURL = '/api'

Vue.config.productionTip = false

Vue.use(ElementUI) // 使用elementUI
/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store
})
